<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/safeai/jsp/common/taglibs.jsp"%> 
<html>
	<head>
		<title>部门管理</title>
		<%@ include file="/pages/safeai/jsp/common/meta.jsp"%>
		<link href="${ctx}/css/safeai/together.css" rel="stylesheet" type="text/css">
	    <script language="javascript"> 
			function sub(){//利用对话框返回的值 （true 或者 false）
				 var value = window.operatorForm.rolename.value;
				 if(value == null || value == ""){
				 	alert("请输入角色名!");
				 	window.operatorForm.rolename.focus();
				 	return false;
				 }
			}
			
			function checked(){
				var menus = window.operatorForm.menus.value;
				var checkboxs = window.operatorForm.menuId;
				
				if(menus!=null && menus!=""){
					var menuArr = menus.split(",");
					for (i = 0; i <checkboxs.length; i++){ 
						for (j = 0; j <menuArr.length; j++){  
							if(checkboxs[i].value==menuArr[j]){
								checkboxs[i].checked=true;
							}
						}
					}
				}
				
				var omenus = window.operatorForm.omenus.value;
				var ocheckboxs = window.operatorForm.omenuId;
				
				if(omenus!=null && omenus!=""){
					var omenuArr = omenus.split(",");
					for (i = 0; i <ocheckboxs.length; i++){ 
						for (j = 0; j <omenuArr.length; j++){  
							if(ocheckboxs[i].value==omenuArr[j]){
								ocheckboxs[i].checked=true;
							}
						}
					}
				}
				
			}
		</script>
	</head>
	<body onload="checked()">
		<form action="${ctx}/operator.do?method=updateRole" method="post" name="operatorForm">
			 <table width="480px" align="center"> 
			 	<input type="hidden" id="menus" value="${operator.menuId}">
			 	<input type="hidden" id="omenus" value="${operator.omenuId}">
			 	<tr>
			 		<th colspan="2" height="25px">部门管理</th>
			 	</tr>
				<tr>
					<td class="td_01">角色名：</td>
					<td class="td_04"><input type="text" id="rolename" name="operator.rolename" maxlength="10" value="<bean:write name="operator" property="rolename" />"/><span class="STYLE1">*</span></td> 
					<input type="hidden" name="operator.roleid" value="<bean:write name="operator" property="roleid" />"/>		    
	            </tr>
				<tr>
					<td class="td_01">显示菜单：</td>
					<td class="td_04">
						<input type="checkbox" name="menuId" value="1"/>商城管理&nbsp;<input type="checkbox" name="menuId" value="3"/>前台管理&nbsp;
						<input type="checkbox" name="menuId" value="4"/>系统管理&nbsp;
					</td> 
				</tr> 
				<tr> 
					<td class="td_01">&nbsp;</td>
					<td class="td_04">
						<input type="checkbox" name="menuId" value="5"/>咨询管理&nbsp;<input type="checkbox" name="menuId" value="6"/>新增功能&nbsp;
						<input type="checkbox" name="menuId" value="8"/>Erp管理&nbsp;
					</td> 
				</tr>  
				<tr> 
					<td class="td_01">&nbsp;</td>
					<td class="td_04">
						<input type="checkbox" name="menuId" value="11"/>商品预订子系统&nbsp;<input type="checkbox" name="menuId" value="12"/>优惠卷&nbsp;
					</td> 
				</tr>
				<tr> 
					<td class="td_01">&nbsp;</td>
					<td class="td_04">
						<input type="checkbox" name="menuId" value="9"/>员工&部门管理&nbsp;<input type="checkbox" name="menuId" value="10" checked style="display:none"/><div style="display:none">安全退出</div>&nbsp;
					</td> 
				</tr>
				<tr> 
					<td class="td_01">&nbsp;</td>
					<td class="td_04">
						 <input type="checkbox" name="menuId" value="7"/>会员管理&nbsp;
					</td> 
				</tr>
				<tr> 
					<td class="td_01">会员管理子菜单:</td>
					<td class="td_04">
						<input type="checkbox" name="omenuId" value="6"/>定时邮件&nbsp;<input type="checkbox" name="omenuId" value="7"/>定时短信&nbsp;
					</td> 
					
				</tr>
				<tr> 
					<td class="td_01">&nbsp;</td>
					<td class="td_04">
						<input type="checkbox" name="omenuId" value="8"/>发送短信&nbsp;<input type="checkbox" name="omenuId" value="9"/>查看定时任务&nbsp;
					</td> 
				</tr>
				<tr> 
					<td class="td_01">&nbsp;</td>
					<td class="td_04">
						<input type="checkbox" name="menuId" value="2"/>订单管理&nbsp;
					</td> 
				</tr>
				<tr> 
					<td class="td_01">订单管理子菜单:</td>
					<td class="td_04">
						<input type="checkbox" name="omenuId" value="1"/>客服部&nbsp;<input type="checkbox" name="omenuId" value="2"/>财务部&nbsp;
						<input type="checkbox" name="omenuId" value="3"/>物流部1&nbsp;
					</td> 
				</tr>
				<tr>
					<td class="td_01">&nbsp;</td> 
					<td class="td_04">
						<input type="checkbox" name="omenuId" value="4"/>物流部2&nbsp;
						<input type="checkbox" name="omenuId" value="5"/>产品部处理&nbsp;
					</td> 
				</tr> 
				<tr> 
					<td colspan="2" align="center"><input type="submit" class="btn" value="修改" onclick="return sub();"/></td>
				</tr>
		    </table>
		</form> 
	</body>
</html> 